import {PlayerAction, MAX_PLAYER, INVALID_SEAT, Comb, BankerAction, Base} from "./GameDefine_nbddz";
export class GameData_nbddz{
    handCards:Array<any>;
    outCards:Array<any>;
    action?:Array<PlayerAction>;
    roundCurSeat:number = INVALID_SEAT;
    roundCurPower:number = PlayerAction.NULL;
    preSeat:number|any = null;               //最后一个出牌玩家的座位号
    preComb:Comb|any=null;               //最后一个出牌的组合
    base:number=Base.base1; //底分
    curJiaoSeat:number = INVALID_SEAT;
    curJiaoPower:number = BankerAction.NULL;
    bankerAction:Array<{seat:number,action:BankerAction}>;
    bankerSeat:number = INVALID_SEAT; //地主座位
    diPaiCards:Array<number>;
    constructor(){
        this.reset();
    }

    reset(){
        this.handCards = new Array(MAX_PLAYER);
        this.outCards = new Array(MAX_PLAYER);
        for(let i=0;i<MAX_PLAYER;i++){
            this.handCards[i] = [];
            this.outCards[i] = [];
        }
        this.action = new Array(MAX_PLAYER).fill(PlayerAction.NULL);
        this.roundCurSeat = INVALID_SEAT;
        this.roundCurPower = PlayerAction.NULL;
        this.preSeat = null;
        this.preComb = null;

        this.base=Base.base1;
        this.bankerSeat = INVALID_SEAT
        this.bankerAction = [];
        this.curJiaoSeat= INVALID_SEAT;
        this.curJiaoPower= BankerAction.NULL;
        this.diPaiCards=[]
    }

    resetRound(){
        this.preSeat = null;
        this.preComb = null;
        this.action = new Array(MAX_PLAYER).fill(PlayerAction.NULL);
        this.outCards = new Array(MAX_PLAYER);
    }

    isBanker(seat:number){
        return seat == this.bankerSeat
    }
}